package com.lotus.crm.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.lotus.crm.domain.Customer;

public interface CustomerRepository extends JpaRepository<Customer, Integer>{

	
	List<Customer> findByFixedAreaIdIsNull();

	@Query("update Customer set fixedAreaId =?2 where id=?1")
	@Modifying
	void updateFixedAreaIdById(Integer id, String fixedAreaId);

	List<Customer> findByFixedAreaId(String fixedAreaId);

	Customer findByTelephone(String telephone);

	@Query("update Customer set type =1 where telephone=?")
	@Modifying
	void updateTypeByTelephone(String telephone);
	
}
